package com.power.flowable.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  流程环节组办结时限实体类
*/

@Entity
@ApiModel(value="流程环节组办结时限")
@Data
@Table(name="Log_limitscat")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Log_limitscat.Log_limitscatPK.class) 用于复合组件
public class Log_limitscat extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1L;

    @Id
    private String id;

    @ApiModelProperty(value = "申请applyid")
    private String applyid;

    @ApiModelProperty(value = "流程实例id")
    private String procinstid;

    @ApiModelProperty(value = "环节组id")
    private String scatid;

    @ApiModelProperty(value = "首次开始日期", example="2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date startdate;

    @ApiModelProperty(value = "限时办结日期")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date enddate;

    @ApiModelProperty(value = "告警日期")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date warndate;

    @ApiModelProperty(value = "实际结束日期", example="2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date finishdate;

    @ApiModelProperty(value = "限时天数")
    private Integer daylimit;

    @ApiModelProperty(value = "环节定义id")
    @Transient
    private String stepid;

    @ApiModelProperty(value = "任务id")
    @Transient
    private String taskid;


    @ApiModelProperty(value = "任务开始时间")
    @Transient
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date starttime;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("applyid", this.getApplyid());
        map.put("procinstid", this.getProcinstid());
        map.put("scatid", this.getScatid());
        map.put("startdate", this.getStartdate());
        map.put("enddate", this.getEnddate());
        map.put("warndate", this.getWarndate());
        map.put("finishdate", this.getFinishdate());
        map.put("daylimit", this.getDaylimit());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Log_limitscatPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Log_limitscatPK pk = (Log_limitscatPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}
